<?php

include('../includes/smarty.php');
include_once('../config.php');

$ADMIN = new Admin();

session_start();

if(isset($_SESSION["id"]))
{
	//	Validate the session.
	$row = $ADMIN->validate_admin_session($_SESSION["id"]);
	
	if($row)
	{
		//	Change the lastvisit date, and show the admin screen.
		$ADMIN->update_lastvisit($_SESSION["id"]);
		
		$smarty->assign('title', 'Admin Reports -- Track Open Applications');
		$smarty->assign('path', $site);
		$smarty->assign('body', 'main/admin/trackOpen.tpl');

		$smarty->display('admin.tpl');
	}
	else
	{
		//	Kill the current session, and show the login screen.
		session_destroy();
		header('Location: ../admin');
	}
}
?>